package com.brzjomo.secretiveworld.util;

import com.brzjomo.secretiveworld.SecretiveWorld;
import com.brzjomo.secretiveworld.client.gui.CorpseOfAnUnknownTravelerScreen;
import com.brzjomo.secretiveworld.client.gui.CrateScreen;
import com.brzjomo.secretiveworld.client.gui.GreedyChestScreen;
import com.brzjomo.secretiveworld.client.renderer.entity.SwordFishRenderer;
import com.brzjomo.secretiveworld.client.renderer.entity.TestFishRenderer;
import com.brzjomo.secretiveworld.init.ModBlocks;
import com.brzjomo.secretiveworld.init.ModContainerTypes;
import com.brzjomo.secretiveworld.init.ModEntityTypes;

import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

@Mod.EventBusSubscriber(modid = SecretiveWorld.MODID, bus = Bus.MOD, value = Dist.CLIENT)
public class ClientEventBusSubscriber {

	@SubscribeEvent
	public static void clientSetup(FMLClientSetupEvent event) {
		ScreenManager.registerFactory(ModContainerTypes.GREEDY_CHEST.get(), GreedyChestScreen::new);
		ScreenManager.registerFactory(ModContainerTypes.CRATE.get(), CrateScreen::new);
		ScreenManager.registerFactory(ModContainerTypes.CORPSE_OF_AN_UNKNOWN_TRAVELER.get(), CorpseOfAnUnknownTravelerScreen::new);
		//树苗
		RenderTypeLookup.setRenderLayer(ModBlocks.LAUREL_SAPLING.get(), RenderType.getCutout());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_WHITE_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_ORANGE_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_MAGENTA_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_LIGHT_BLUE_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_YELLOW_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_LIME_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_PINK_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_GRAY_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_LIGHT_GRAY_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_CYAN_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_PURPLE_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_BLUE_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_BROWN_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_GREEN_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_RED_STAINED_GLASS.get(), RenderType.getTranslucent());
		RenderTypeLookup.setRenderLayer(ModBlocks.GLOW_BLACK_STAINED_GLASS.get(), RenderType.getTranslucent());
		//Entity
		RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.TEST_FISH_ENTITY.get(), TestFishRenderer::new);
		RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.SWORD_FISH_ENTITY.get(), SwordFishRenderer::new);
	}
}
